#{extends 'magicBox.html' /}
#{set 'title'}${title}
#{/set}

#{if boxId==1}
   #{if user!=null}
	   #{list items:user.projects ,as :'project'}
		    <div class="reload-project-${project.id}-in-user-${user.id}" name="/users/list_user_projects?userId=${user.id}&boxId=2&projectId=${project.id}&currentProjectId=${currentProject.id}">${project.name}
		    		<div class="bar_more_info">#{list items:project.roles ,as :'Role'}
	#{if Role.name!="Project Member" && Role.users.contains(user)}${Role.name} #{/if}
		#{/list}</div>
		    </div>
	   #{/list}
   #{/if}
#{/if}

#{if boxId==2}
   #{if user!=null}
    #{list items:project.roles ,as :'pRole'}
     #{list items:user.roles ,as :'uRole'}
      #{if pRole.id == uRole.id}
      
      <div class="bar"> 
      #{if !uRole.baseRole} 
        ${uRole.name}  
      #{/if} 
      
      #{else} 
          <span title="Base Role"> <i>${uRole.name}</i> </span> 
       #{/else}
      
       #{if ((connected.in(project).can('revokeUserRole'))&&(project.id == currentProject.id))||((user.id == connected.id)&&(!uRole.baseRole))}
	        <a onclick="revokeRole(${uRole.id}, ${uRole.baseRole}, ${user.id}, ${project.id});">
	        <img title="Revoke Role" src="@{'/public/images/famfam/group_delete.png'}">
	        </a>
	    #{/if}
	   </div>
	   
      #{/if}
     #{/list}
    #{/list}
    #{list items:revroles , as:'rev'}
    <div class="bar">Reviewer for the tasks of the  type: ${rev.taskType.name}
    #{if ((connected.in(project).can('revokeUserRole'))||(user.id == connected.id))}
    <a title="revoke reviewing role?" href="#" onclick="revoke_reviewer(${user.id}, ${rev.taskType.id});"><img src="/public/images/famfam/remove-user.png" /></a>
    #{/if}
    </div>
    #{/list}
   #{/if}
#{/if}